package com.wuhongyu.repository;

import com.wuhongyu.base.BaseDao;
import com.wuhongyu.entity.Contr;
import com.wuhongyu.entity.Customer;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface CustomerDao extends BaseDao<Customer> {

    /**
     * 查找所有的客户贡献分析
     * @return
     */
    @Query(nativeQuery = true)
    List<Contr> findContrAll();

    /**
     * 通过名字查找客户贡献分析
     * @param name
     * @return
     */
    @Query(nativeQuery = true)
    List<Contr> findContrByName(String name);

    /**
     * 通过年份客户贡献分析
     * @param year
     * @return
     */
    @Query(nativeQuery = true)
    List<Contr> findContrByYear(String year);

    /**
     * 通过年份和名字
     * @param year
     * @param name
     * @return
     */
    @Query(nativeQuery = true)
    List<Contr> findContrByYearAndName(String year,String name);

}
